import eventfax.protocol._

object TestLineProtocol {
  var buftok: LineProtocol = new LineProtocol("[\r\n]")  
  def main(args: Array[String]) {
    test_with_one_input
    test_with_non_input
    test_with_two_input
    test_with_more_input
    test_with_carriage_return
  }

  def test_with_one_input = {
    this.buftok.extract("Hello World\nman")
    this.buftok.foreach(str => {
      println(str)
    })
  }

  def test_with_non_input = {
    this.buftok.extract("Hello World\n man")
    this.buftok.foreach(str => {
      println(str)
    })
  }

  def test_with_two_input = {
    println("for two")
    this.buftok.extract("Hello World\n man\n")
    this.buftok.foreach(str => {
      println(str)
    })
  }

  def test_with_more_input = {
    println("for more")
    this.buftok.extract("Hello World\n man\nwow\nlol")
    this.buftok.foreach(str => {
      println(str)
    })
  }

  def test_with_carriage_return = {
    this.buftok.flush
    println("For carriage")
    this.buftok.extract("Hello World\r man\rwow\rlol")
    this.buftok.foreach(str => {
      println(str)
    })

  }
}
